home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3dm / audio / alWriteFrames.z / alWriteFrames
Encoding:
Text File  |  1998-10-20  |  6.6 KB  |  133 lines

  1.  
  2.  
  3.  
  4. aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss((((3333ddddmmmm))))                                          aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss((((3333ddddmmmm))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      alWriteFrames - write interleaved sample frames to an audio port
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////aaaauuuuddddiiiioooo....hhhh>>>>
  13.  
  14.      iiiinnnntttt aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss((((ccccoooonnnnsssstttt AAAALLLLppppoooorrrrtttt ppppoooorrrrtttt,,,, vvvvooooiiiidddd ****ssssaaaammmmpppplllleeeessss,,,, ccccoooonnnnsssstttt iiiinnnntttt ffffrrrraaaammmmeeeeccccoooouuuunnnntttt))))
  15.  
  16. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRR
  17.      _p_o_r_t         is the audio output port to which you want to write samples.
  18.                   This is the returned value of an aaaallllOOOOppppeeeennnnPPPPoooorrrrtttt((((3333ddddmmmm)))) call.
  19.  
  20.      _s_a_m_p_l_e_s      is the buffer containing the samples.
  21.  
  22.      _f_r_a_m_e_c_o_u_n_t   is the number of sample frames that you want to write to the
  23.                   audio port.
  24.  
  25. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  26.      aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss transfers data to an audio port from the _s_a_m_p_l_e_s buffer.
  27.      aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss blocks until _f_r_a_m_e_c_o_u_n_t sample frames have been written to
  28.      the port.  If you do not wish to block, make sure that _f_r_a_m_e_c_o_u_n_t is less
  29.      than the return value of aaaallllGGGGeeeettttFFFFiiiillllllllaaaabbbblllleeee((((3333ddddmmmm)))).
  30.  
  31.      The format of the audio data expected by aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss depends upon the
  32.      configuration of the port. Each sample can be an 8-, 16-, or 32-bit
  33.      integer, or a single- or double-precision floating-point value or a block
  34.      of subcode data; see aaaallllSSSSeeeettttSSSSaaaammmmppppFFFFmmmmtttt((((3333ddddmmmm)))), aaaallllSSSSeeeettttFFFFllllooooaaaattttMMMMaaaaxxxx((((3333ddddmmmm)))) and
  35.      aaaallllSSSSeeeettttWWWWiiiiddddtttthhhh((((3333ddddmmmm)))) for a description of how these formats work. By default,
  36.      the sample format is 16-bit integer (short).
  37.  
  38.      Within each sample frame, aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss expects interleaved data.  The
  39.      number of samples per sample frame varies according to the value
  40.      specified by aaaallllSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllssss((((3333ddddmmmm)))). By default, the port accepts stereo data
  41.      (2 samples per frame).
  42.  
  43.      Note that since an audio port contains an internal queue, samples written
  44.      to the port will not immediately come out the associated audio device or
  45.      devices. aaaallllGGGGeeeettttFFFFiiiilllllllleeeedddd((((3333ddddmmmm)))) will indicate how many samples are currently in
  46.      this queue. Also, aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee((((3333ddddmmmm)))) and aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeNNNNuuuummmmbbbbeeeerrrr((((3333ddddmmmm)))) provide
  47.      facilities for precise synchronization of audio and other media.
  48.  
  49.      In order to achieve the best possible performance, aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss does not
  50.      attempt to verify that _p_o_r_t or _s_a_m_p_l_e_s are valid. You should make certain
  51.      these values are valid before passing them as arguments to aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss.
  52.  
  53. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  54.      The following code fragment opens an audio output port and writes a bit
  55.      of (zero) audio data to it.
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss((((3333ddddmmmm))))                                          aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss((((3333ddddmmmm))))
  71.  
  72.  
  73.  
  74.           ALport p;
  75.           short buf[10000];   /* 5000 stereo frames */
  76.  
  77.           /* open a port with the default configuration */
  78.           p = alOpenPort("alWriteFrames example","w",0);
  79.  
  80.           if (!p) {
  81.               printf("port open failed:%s\n", alGetErrorString(oserror()));
  82.               exit(-1);
  83.           }
  84.  
  85.           /*
  86.            * Fill our buffer. Really we'd want to do something more interesting
  87.            * than generating silence.
  88.            */
  89.           bzero(buf, 10000*sizeof(short));
  90.  
  91.           alWriteFrames(p, buf, 5000);       /* write 5000 stereo frames */
  92.  
  93.  
  94. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  95.      aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss always returns 0.
  96.  
  97. NNNNOOOOTTTTEEEESSSS
  98.      On output, the data from all ports on the system writing to a particular
  99.      output device will be mixed together, except in the case of subcode data.
  100.      Because subcode data is treated as inherently logical information, no
  101.      amount mathematics can be applied to perform operations such as mixing.
  102.  
  103. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  104.      alOpenPort(3dm), alGetFillable(3dm), alGetFilled(3dm),
  105.      alSetChannels(3dm), alSetWidth(3dm), alReadFrames(3dm),
  106.      alZeroFrames(3dm), alSetConfig(3dm), alSetQueueSize(3dm),
  107.      alSetSampFmt(3dm), alSetFloatMax(3dm)
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.